import multiprocessing


def msg_send(connect, msg):
	connect.send(msg)


def msg_recv(connect):
	print(f"【数据接收】：{connect.recv()}")


def main():
	# 创建管道时，会返回两个对象，一个是进行输入管道，另一个是输出管道
	connect_receive, connect_send = multiprocessing.Pipe()
	# 创建完管道之后，根据管道创建进程。
	process_send = multiprocessing.Process(target=msg_send, args=(connect_send, ['python', 'java', 'go']))
	# 创建接收线程
	process_receive = multiprocessing.Process(target=msg_recv, args=(connect_receive,))

	process_receive.start()  # 启动接收进程
	process_send.start()  # 启动发送进程


if __name__ == '__main__':
	main()
